/*
 * @Description: 服务器管理
 * @Date: 2023-11-16 09:18:11
 * @FilePath: \hksj-vued:\03code\hk-iot\src\api\configuration\server\index.ts
 */
import request from '/@/utils/request';

/**
 * @method addEnergyType 添加类型
 * @method queryEnergyTypeTree 查询类型书
 * @method queryEnergyCostByEnergyTypeId 根据能源类型id查询阶梯费率信息
 * @method delEnergyCost 删除阶梯费率
 * @method delEnergyType 查询类型书
 * @method queryEnergyType 根据id查询能耗类型详细信息
 * @method updateEnergyType 修改能耗类型
 * @method updateEnergyCost 修改费率阶梯
 * @method addEnergyCost 新增阶梯费率
 * @method queryServerListByPaging 分页查询机构列表
 */
export function useEnergyCostApi() {
  return {
    addEnergyType: (params: object) => {
      return request({
        url: '/api/mqtt/energyType/addEnergyType',
        method: 'POST',
        data: params,
      });
    },
    queryEnergyTypeTree: (params: object) => {
      return request({
        url: '/api/mqtt/energyType/queryEnergyTypeTree',
        method: 'POST',
        data: params,
        headers: {
          'content-type': "application/x-www-form-urlencoded"
        }
      });
    },
    queryEnergyCostByEnergyTypeId: (params: object) => {
      return request({
        url: '/api/mqtt/energyCost/queryEnergyCostByEnergyTypeId',
        method: 'POST',
        data: params,
        headers: {
          'content-type': "application/x-www-form-urlencoded"
        }
      });
    },
    delEnergyCost: (id: string) => {
      return request({
        url: `/api/mqtt/energyCost/delEnergyCost/${id}`,
        method: 'DELETE',
      });
    },
    delEnergyType: (id: string) => {
      return request({
        url: `/api/mqtt/energyType/delEnergyType/${id}`,
        method: 'DELETE',
      });
    },
    queryEnergyType: (id: string) => {
      return request({
        url: `/api/mqtt/energyType/queryEnergyType/${id}`,
        method: 'GET',
      });
    },
    updateEnergyType: (params: object) => {
      return request({
        url: '/api/mqtt/energyType/updateEnergyType',
        method: 'PUT',
        data: params,
      });
    },
    updateEnergyCost: (params: object) => {
      return request({
        url: '/api/mqtt/energyCost/updateEnergyCost',
        method: 'PUT',
        data: params,
      });
    },
    addEnergyCost: (params: object) => {
      return request({
        url: '/api/mqtt/energyCost/addEnergyCost',
        method: 'POST',
        data: params,

      });
    },
    queryServerListByPaging: (params: object) => {
      return request({
        url: '/api/mqtt/organization/queryServerListByPaging',
        method: 'POST',
        data: params,
      });
    },
  };
}
